﻿using System;
using System.Web.UI.WebControls;
using MedicWeb.MedicService;

namespace MedicWeb.forms.Print.List
{
    public partial class InvoiceList : SessionPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var mc = new MainService();
            PrintTemplateInvoice[] printTemplateInvoiceList = mc.GetPrintTemplateInvoiceList(GetSession(), false);
            foreach (PrintTemplateInvoice templateInvoice in printTemplateInvoiceList)
            {
                var row = new TableRow();
                var cellEdit = new TableCell();
                var cellTitle = new TableCell();

                cellEdit.Width = 24;
                cellEdit.Controls.Add(
                    new HyperLink
                        {
                            NavigateUrl = ResolveUrl("~/forms/Print/Edit/InvoiceEdit.aspx?id=" + templateInvoice.Id),
                            CssClass = "modal edit"
                        });
                
                cellTitle.Text = (templateInvoice.Active ? "Активный: " : "") + templateInvoice.Title;

                row.Cells.Add(cellEdit);
                row.Cells.Add(createDeleteCell(templateInvoice));
                row.Cells.Add(cellTitle);

                TableOrders.Rows.Add(row);
            }
        }

    }
}